package UserModel

// 定义一个函数
type UserModelAttrFunc func(u *UserModelImpl)

// 定义UserModelAttrFunc的切片
type UserModelAttrFuncs []UserModelAttrFunc

// 入参
func WithUserID(id int) UserModelAttrFunc {
	return func(u *UserModelImpl) {
		u.UserId = id
	}
}

func WithUserName(name string) UserModelAttrFunc {
	return func(u *UserModelImpl) {
		u.UserName = name
	}
}

func (this UserModelAttrFuncs) Apply(u *UserModelImpl) {
	for _, f := range this {
		f(u)
	}
}
